const {seq, DataTypes} = require('../sequelize')

const AuthAttributes = {
    pid: {
        type: DataTypes.INTEGER,
        Comment: '父id'
    },
    name: {
        type: DataTypes.STRING,
        allowNull: false,
        Comment: '权限名',
        unique: false  
    },
    namecn: {
        type: DataTypes.STRING,
        allowNull: false,
        Comment: '权限名中文',
        unique: true 
    },
    level: { /* 1,2 */
        type: DataTypes.INTEGER,
        select: true,
        allowNull: false,
        Comment: '层级'
    },
    path: {
        type: DataTypes.STRING,
        Comment: '绝对路径'
    },
    state: { 
        type: DataTypes.BOOLEAN,
        defaultValue: true,
        Comment: '是否生效',
    }
}

const Auth = seq.define('yyb_auth',AuthAttributes, {
    createdAt: true,
    updatedAt: true,
    timestamps: false,
    freezeTableName: true
})

Auth.sync() 

module.exports = {
    Auth,
    AuthAttributes 
} 
